public class li2 {
    public static void main(String[] args) {
        int n = 2;
        int m = 2;
        int p = 0;
        for(int i=2;i<=n;i++)
        {
            p=(p+m)%i;
        }
        System.out.println(p+1);
    }
}
